/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package robosym.utils;

/**
 *
 * @author TR
 */
public class Geo {
    public static float distance(float x1, float y1, float x2, float y2){
        float dx = x2-x1;
        float dy = y2-y1;
        return (float)Math.sqrt(dx*dx + dy*dy);
    }
    
    public static float distance(float dx, float dy){
        return (float)Math.sqrt(dx*dx + dy*dy);
    }
    
    public static float angleOfVectorRad(float x, float y){
        if (x == 0){
            //zero division protection
            return 0;
        }
        double angleRad = Math.atan(y/x);
        if(x<0) angleRad = Math.PI + angleRad;
        
        return (float)angleRad;
    }
}
